<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('学员信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>手机号：</label>
                                <input type="text" name="stuMobile"/>
                            </li>
                            <li>
                                <label>微信号：</label>
                                <input type="text" name="stuWechat"/>
                            </li>
                            <li>
                                <label>微信名：</label>
                                <input type="text" name="stuWechatName"/>
                            </li>
                            <li>
                                <label>QQ号：</label>
                                <input type="text" name="stuQq"/>
                            </li>
                            <li>
                                <label>固定电话：</label>
                                <input type="text" name="stuPhone"/>
                            </li>
                            <li>
                                <label style="width: 95px;">其他联系方式：</label>
                                <input type="text" name="stuOtherContact"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="duplicateSearch()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<!--                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"></a><button class="fa fa-refresh" type="reset">重置</button>-->
                                <button class="btn btn-warning btn-rounded btn-sm" type="reset"><i class="fa fa-refresh"></i>重置</button>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var stuEducationCodeDatas = [[${@dict.getType('crm_edu_code')}]];
        var prefix = ctx + "crm/duplicate/student";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "学员信息",
                firstLoad: false,
                showRefresh: false,
                striped: true,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'stuName',
                    title: '姓名'
                },
                {
                    field: 'stuMobile',
                    title: '手机号'
                },
                {
                    field: 'stuPhone',
                    title: '固定电话'
                },
                {
                    field: 'stuWechat',
                    title: '微信号'
                },
                {
                    field: 'stuWechatName',
                    title: '微信名'
                },
                {
                    field: 'stuQq',
                    title: 'QQ号'
                },
                {
                    field: 'stuOtherContact',
                    title: '其他联系方式'
                },
                {
                    field: 'resourceUser',
                    title: '推广人员'
                },
                {
                    field: 'salesman',
                    title: '销售人员'
                },
                {
                    field: 'stuCity',
                    title: '学员城市'
                },
                {
                    field: 'stuEducationCode',
                    title: '学员学历',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(stuEducationCodeDatas, value);
                    }
                }]
            };
            $.table.init(options);
        });

        /*跟进记录-详细*/
        function duplicateSearch() {

            var stuMobile = $("input[name='stuMobile']").val();
            var stuWechat = $("input[name='stuWechat']").val();
            var stuQq = $("input[name='stuQq']").val();
            var stuPhone = $("input[name='stuPhone']").val();
            var stuOtherContact = $("input[name='stuOtherContact']").val();

            console.debug(stuMobile);
            console.debug(stuWechat)

            if(!stuMobile && !stuWechat && !stuQq && !stuPhone && !stuOtherContact) {
                $.modal.msgWarning('至少填写一个关键信息');

                return false;
            }

            $.table.search();
        }
    </script>
</body>
</html>